<?php
// No direct access
defined('_JEXEC') or die('Restricted access');

//JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers'.DS.'html');
require_once JPATH_COMPONENT.'/helpers/html/ajaxwhois.php';

JHtmlAjaxWhois::tipStyle();
JHTML::_('behavior.tooltip');
JHTML::_('behavior.formvalidation');
?>
<script type="text/javascript">
<!--
	function submitbutton(task) {
		var me = document.adminForm;
		var invalid = Array();
		var i = 0;
		if (me['jform[notfound]'].disabled) {
			me['jform[notfound]'].disabled = false;
		}
		if (me['jform[byePass]'].value == "0" && me['jform[server]'].value == "") {
			invalid[i] = 'jform_server-lbl';
			i++;
			invalid[i] = 'jform_server';
			i++;
		}
		if (me['jform[byePass]'].value == "0" && me['jform[notfound]'].value == "") {
			invalid[i] = 'jform_notfound-lbl';
			i++;
			invalid[i] = 'jform_notfound';
			i++;
		}
		if (task == 'extension.cancel' || (document.formvalidator.isValid(document.id('extension-form')) && invalid.length==0)) {
			submitform(task);
		} else {
			if (invalid.length>0) {
				validate( invalid );
			}
			alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		}
	}
	function validate( invalid ) {
		invalid.each(function(element) {
			$(element).addClass('invalid');
		});
	}
// -->
</script>

<form action="<?php echo JRoute::_('index.php?option=com_ajaxwhois'); ?>" method="post" name="adminForm" id="extension-form" class="form-validate">
    <div class="width-60 fltlft">
        <fieldset class="adminform">
            <legend><?php echo empty($this->item->id) ? JText::_('COM_AJAXWHOIS_NEW_EXTENSION') : JText::sprintf('COM_AJAXWHOIS_EDIT_EXTENSION', $this->item->id); ?></legend>
			<ul class="adminformlist">
				<li><?php echo $this->form->getLabel('title'); ?>
				<?php echo $this->form->getInput('title'); ?></li>

				<li><?php echo $this->form->getLabel('price'); ?>
				<?php echo $this->form->getInput('price'); ?></li>

				<li><?php echo $this->form->getLabel('byePass'); ?>
				<?php echo $this->form->getInput('byePass'); ?></li>

				<li><?php echo $this->form->getLabel('server'); ?>
				<?php echo $this->form->getInput('server'); ?></li>
                
				<li><?php echo $this->form->getLabel('notfound'); ?>
				<?php echo $this->form->getInput('notfound'); ?></li>
                
				<li><?php echo $this->form->getLabel('registerP'); ?>
				<?php echo $this->form->getInput('registerP'); ?></li>
                
				<li><?php echo $this->form->getLabel('transferP'); ?>
				<?php echo $this->form->getInput('transferP'); ?></li>
                
				<li><?php echo $this->form->getLabel('hostingP'); ?>
				<?php echo $this->form->getInput('hostingP'); ?></li>
                
				<li><?php echo $this->form->getLabel('extGroup'); ?>
				<?php echo $this->form->getInput('extGroup'); ?></li>
                
				<li><?php echo $this->form->getLabel('extCat'); ?>
				<?php echo $this->form->getInput('extCat'); ?></li>
                
				<li><?php echo $this->form->getLabel('descr'); ?>
				<?php echo $this->form->getInput('descr'); ?></li>
                
				<li><?php echo $this->form->getLabel('id'); ?>
				<?php echo $this->form->getInput('id'); ?></li>
			</ul>
        </fieldset>
    </div>
    <input type="hidden" name="task" value="" />
    <?php echo JHtml::_('form.token'); ?>
</form>
